import HttpRequest from "../request";

/**
 * 新增订单
 *
 */
export async function addOrder(params) {
  return HttpRequest({
    url: `/order`,
    method: "POST",
    params: params,
  });
}

/**
 * 根据id修改订单
 *
 */
export async function updateOrder(id, params) {
  return HttpRequest({
    url: `/order/${id}`,
    method: "PATCH",
    params: params,
  });
}

/**
 * 根据id删除订单
 *
 */
export async function removeOrder(id, params) {
  return HttpRequest({
    url: `/order/${id}`,
    method: "DELETE",
    params: params,
  });
}

/**
 * 根据token获取订单
 *
 */
export async function getOrder(params) {
  return HttpRequest({
    url: `/order/getOrderByUserId`,
    method: "GET",
    params: params,
  });
}

/**
 * 对订单进行评论
 *
 */
export async function addReviews(params) {
  return HttpRequest({
    url: `/reviews`,
    method: "POST",
    params: params,
  });
}

/**
 * 查询我的评论
 *
 */
export async function queryMyReviews(params) {
  return HttpRequest({
    url: `/reviews/my`,
    method: "GET",
    params: params,
  });
}
